﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace aaaa
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }



        private void button1_Click(object sender, EventArgs e)
        {

            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("用户、密码不可为空", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBox1.Text = "";
                textBox2.Text = "";
                textBox1.Focus();
            }
            else
            {
                string sql = "select password from from1 where name='" + textBox1.Text + "'";
                SqlOperate sqlOperate = new SqlOperate();
                if (sqlOperate.getString(sql) == textBox2.Text)
                {
                    Class1.userbool = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("用户、密码错误！", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox1.Focus();
                }
            }
        }
    }
}
